from dataclasses import dataclass
from typing import Optional

from sks.agent.CallbackHandler import OpenAICallbackHandler


@dataclass
class _Settings:
    """Settings for the sks, lazily initialized."""
    _openai_callback_handler:Optional[OpenAICallbackHandler] =None


    @property
    def openai_callback_handler(self) -> OpenAICallbackHandler:
        """Get the callback manager."""
        if self._openai_callback_handler is None:
            # self._openai_callback_handler = OpenAICallbackHandler()
            from app.services.DbOpenAICallbackHandler import DbOpenAICallbackHandler
            self._openai_callback_handler = DbOpenAICallbackHandler()
        return self._openai_callback_handler

    @openai_callback_handler.setter
    def openai_callback_handler(self, _openai_callback_handler: OpenAICallbackHandler) -> None:
        """Set the callback manager."""
        self._openai_callback_handler = _openai_callback_handler

# Singleton
Settings = _Settings()
